<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue-2.6.12.js"></script>
</head>
<body>
  <div id="app">
    {{vuecount}}
    <buttoncount @abc="changeVueCount"></buttoncount>
  </div>
  <template id="buttoncount">
    <div>
      <span>{{count}}</span><button @click="changeCount">点我加一</button>
    </div>
  </template>
  <script>
    var buttoncount = {
      template:"#buttoncount",
      data:function(){
        return {
          count:0
        }
      },
      methods:{
        changeCount:function(){
          this.count++;
          this.$emit("abc",this.count);
        }
      }
    };
    new Vue({
      el:"#app",
      components:{
        buttoncount
      },
      data:{
        vuecount:0
      },
      methods:{
        changeVueCount:function(value){
          this.vuecount = value;
        }
      }
    });
  </script>
</body>
</html>